﻿using System; 
using System.Text;
using System.Collections.Generic; 
using System.Data;
using SF.Common;
using SF.Model;
namespace SF.BLL {
	 	//sf_door_words
		public partial class sf_door_words
	{
   		     
		private readonly SF.DAL.sf_door_words dal=new SF.DAL.sf_door_words();
		public sf_door_words()
		{}
		
		#region  Method
		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(long id)
		{
			return dal.Exists(id);
		}

		/// <summary>
		/// 增加一条数据
		/// </summary>
		public long  Add(SF.Model.sf_door_words model)
		{
						return dal.Add(model);
						
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(SF.Model.sf_door_words model)
		{
			return dal.Update(model);
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(long id)
		{
			
			return dal.Delete(id);
		}
				/// <summary>
		/// 批量删除一批数据
		/// </summary>
		public bool DeleteList(string idlist )
		{
			return dal.DeleteList(idlist );
		}
		
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public SF.Model.sf_door_words GetModel(long id)
		{
			
			return dal.GetModel(id);
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			return dal.GetList(strWhere);
		}
		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			return dal.GetList(Top,strWhere,filedOrder);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<SF.Model.sf_door_words> GetModelList(string strWhere)
		{
			DataSet ds = dal.GetList(strWhere);
			return DataTableToList(ds.Tables[0]);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<SF.Model.sf_door_words> DataTableToList(DataTable dt)
		{
			List<SF.Model.sf_door_words> modelList = new List<SF.Model.sf_door_words>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				SF.Model.sf_door_words model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new SF.Model.sf_door_words();					
													if(dt.Rows[n]["id"].ToString()!="")
				{
					model.id=long.Parse(dt.Rows[n]["id"].ToString());
				}
																																				model.name= dt.Rows[n]["name"].ToString();
																																model.phone= dt.Rows[n]["phone"].ToString();
																																model.remark= dt.Rows[n]["remark"].ToString();
																												if(dt.Rows[n]["status"].ToString()!="")
				{
					model.status=int.Parse(dt.Rows[n]["status"].ToString());
				}
																																				model.backMsg= dt.Rows[n]["backMsg"].ToString();
																						
				
					modelList.Add(model);
				}
			}
			return modelList;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetAllList()
		{
			return GetList("");
		}
#endregion
   
	}
}